//
// Created by jsjxsy on 2022/6/29.
//
#include <stdio.h>
#include <stdlib.h>
#define EVEN_GT(x, y) (x%2==0) && (x>y) ? 1:0
#define PRINT(value) printf(#value"=%d\n",value)
#define SPACE ' '
#define CONSTANT_ONE 25
#define PS() putchar(SPACE)
#define BIG(x) ((x)+3)
#define SUMSQ(x, y) ((x)*(x)+(y)*(y))
#define PRINTF(value) printf("name : "#value";value : %d;address : %p\n",value,&value)
#define PR_DATE printf("Date = %s\n", __DATE__)
#define BOOL(x) _Generic((x),_Bool:"boolean",default:"not boolean")

int compare(const void *a, const void *b) {
  return (*(int *) b - *(int *) a);
}

int main(void) {
  int result = EVEN_GT(4, 3);
  printf("result = %d\n", result);
  PRINT(4 + 5);
  PRINT(4 * 12);
  printf("SPACE = %c\n", SPACE);
  printf("CONSTANT_ONE = %d\n", CONSTANT_ONE);
  PS();
  int temp = BIG(10);
  printf("temp = %d\n", temp);
  temp = SUMSQ(3, 4);
  printf("temp = %d\n", temp);
  int age = 18;
  PRINTF(age);
  PR_DATE;

#define __SKIP__
#ifndef __SKIP__
  puts("this is skip coding area");
#endif
  puts(BOOL(1));
  int arr[5] = {4, 9, 3, 2, 6};
  qsort(arr, 5, sizeof(int), compare);
  for (int i = 0; i < 5; i++) {
    printf("arr[%d]=%d\n", i, arr[i]);
  }
  return 0;
}
